package com.wr.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author weirong
 * @Title:
 * @Description:
 * @date 2018/6/616:41
 */
@Configuration
public class WebMvcConf extends WebMvcConfigurerAdapter {

    @Autowired
    private AuthInterceptor authInterceptor;
    @Autowired
    private AuthActionInterceptor authActionInterceptor;

    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authInterceptor).excludePathPatterns("/static").addPathPatterns("/**");
        registry.addInterceptor(authActionInterceptor)
                .addPathPatterns("/blog/toAdd").addPathPatterns("/blog/add").addPathPatterns("/comment/add").addPathPatterns("/user/resetPw").addPathPatterns("/user/toResetPw");

        super.addInterceptors(registry);
    }


}
